#封装继承和多态
#封装
class Phone:
    # __XXX 私有成员变量,私有成员方法,不能在类对象中使用,类内部可以访问
    __current =None
    name = 'lz'
    def __keep(self):
        print("私有成员方法")
    def call_by(self,num):
        self.__keep()
        self.__current = num
        return self.__current
myphone = Phone()
count = myphone.call_by(6)
print(count)

# 继承
# 单继承
class new_phone(Phone):
    country = "ks"
    face_id = '1111111111'
    # def __init__(self,faceId):
    #     self.face_id = faceId
        # super调用父类的init方法
        # super().__init__()

my_new_phone = new_phone()
count1 = my_new_phone.face_id
print(count1)

class duo_ji_cheng():
    country = "sdsdsd"
    mid_key="word"
    def print_info(self):
        return self.country

# 多继承
class test(duo_ji_cheng,new_phone):
    # pass表示空,保证类定义的完整性
    # pass
    mid_key="复写父类的属性"
    # 访问父类中的属性和方法
    duo_ji_cheng.country = '看见'
    def new_print(self):
        num = super().print_info()
        return num
test = test()
test.print_info()
# 同名属性继承时形参在前面的最先继承
print(test.country)
print(test.mid_key)
print('父类')
print(test.new_print())

